<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			var reg=/\w/;/*任意字母数字下划线*/
			console.log(reg.test("abc123"));
			reg=/\W/;/*除了字母数字下划线*/
			console.log(reg.test("!@#$%^&*"));
			reg=/\d/;/*任意数字*/
			console.log(reg.test("123"));
			reg=/\D/;/*除了数字*/
			console.log(reg.test("a!@"));
			reg=/\s/;/*空格*/
			console.log(reg.test(" "));
			reg=/\S/;/*除了空格*/
			console.log(reg.test("abc123"));
			
			
			reg=/\bchild\b/;/*\b单词边界*/
			console.log(reg.test("hello child goodbye"));
			reg=/\B/;/*除了单词边界*/
			console.log(reg.test("abc123"));
			
		/*去除前后空格*/
			var str="             a d m i n              ";
			console.log(str);
			str=str.replace(/^\s*|\s*$/g,"");
			console.log(str);
		</script>
	</head>
	<body>
	</body>
</html>
